import { post, get, Delete } from "../utlis/http.js"
export const addFormula = {
  //添加配方
  addTbrecipe (param, type) {
    if (type == "添加配方") {
      return post(`/tbrecipe/add`, param)
    } else {//修改配方
      return post(`/tbrecipe/modify`, param)
    }
  },
  //获取配方列表
  getTbrecipeList (param) {
    if (param.field) {
      return post(`/tbrecipe/list?page=${param.page}&size=${param.size}&sort=${param.field},${param.order}`, param)
    } else {
      return post(`/tbrecipe/list?page=${param.page}&size=${param.size}`, param)
    }

  },
  //修改配方状态
  modifyStatus (param) {
    return post(`/tbrecipe/modifyStatus`, param)
  },
  // 删除配方
  removeTbrecipe (id) {
    return Delete(`/tbrecipe/remove/${id}`)
  },
  //修改配方设备组
  modifyTrain (param) {
    return post(`/tbrecipe/modifyTrain`, param)
  },
  findTbrecipe (id) {
    return get(`/tbrecipe/find/${id}`)
  },
  //复制配方
  copyTbrecipe (param) {
    return post(`/tbrecipe/copy`, param)
  },
  //查看配方
  viewTbrecipe (param) {
    return post(`/tbrecipe/view`, param)
  },
  //查看配方BOM
  viewBomTbrecipe (param) {
    return post(`/tbrecipe/viewBoom`, param)
  },

  checkTbrecipe (id) {
    return get(`/tbrecipe/check/${id}`)
  },

  // 查询图标接口
  findIconDataApi(param) {
    return post(`/recipeGraph/find`, param)
  },
}

